package com.duanfh.Request.impl;

import com.duanfh.Request.Request;
import org.apache.log4j.Logger;

import java.io.InputStream;

public class MyRequest implements Request {
    private static Logger logger = Logger.getLogger(MyRequest.class);
    private String myMethod;
    private String Myurl;

    public MyRequest(InputStream inputStream) throws Exception{
        byte[] byteBuffer = new byte[1024];
        int len = 0;
        String str= null;
        if((len = inputStream.read(byteBuffer))>0){
            str = new String(byteBuffer,0,len);
        }
        String data = str.split("\n")[0];
        String[] params = data.split(" ");
        this.myMethod = params[0];
        this.Myurl = params[1];
    }

    public String getMyMethod() {
        return myMethod;
    }

    public void setMyMethod(String myMethod) {
        this.myMethod = myMethod;
    }

    public String getMyurl() {
        return Myurl;
    }

    public void setMyurl(String myurl) {
        Myurl = myurl;
    }
}
